package com.ai.wxy.spring.user.dto;

import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.Date;

/**
 * 用户DTO
 *
 * @author 石头
 * @Date 2019/10/25
 * @Version 1.0
 **/
@Data
public class UserDTO {
    /**用户ID*/
    @NotNull(groups = Update.class)
    private Long id;
    /**用户名称*/
    @NotBlank(groups = Addate.class)
    @Pattern(regexp = "(?=[a-zA-Z])(?:[a-z0-9A-Z])[a-z0-9A-Z-|_]{6,}",message = "格式错误【用户名称为字母开头且长度为6~10】",groups={Addate.class,Update.class})
    private String username;

    /**用户Email*/
    @NotBlank(groups = Addate.class)
    @Pattern(regexp = "([a-zA-Z]+[-|_]?)+[a-z0-9A-Z]+@[a-z0-9A-Z]+\\.[a-zA-Z]{2,}",message = "Email格式错误",groups={Addate.class,Update.class})
    private String email;

    /**用户手机号*/
    @NotBlank(groups = Addate.class)
    @Pattern(regexp = "1[3456789]\\d{9}",message = "手机号格式错误",groups={Addate.class,Update.class})
    private String phone;

    /**用户密码*/
    private String password;

    /**创建时间*/
    private Date createTime;

    /**更新时间*/
    private Date updateTime;

    /**数据有效性*/
    private Integer status;

    public @interface Update {}
    public @interface Addate {}
}
